package com.mk.admin.controller;

import com.mk.admin.model.ResultDto;
import com.mk.admin.model.vo.ListIdsVo;
import com.mk.admin.model.vo.RAdminRoleBatchVo;
import com.mk.admin.model.vo.RAdminRoleVo;
import com.mk.admin.service.RAdminRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/a/adm/rAdminRole")
@Api(tags = "关联-账号和角色")
public class RAdminRoleController {
    @Autowired
    private RAdminRoleService rAdminRoleService;

    @PostMapping("/add")
    public ResultDto add(@RequestBody RAdminRoleVo vo) {
        return rAdminRoleService.add(vo);
    }

    @PostMapping("/addBatch")
    @ApiOperation("批量增加当前用户的角色")
    public ResultDto addBatch(@RequestBody RAdminRoleBatchVo vo) {
        return rAdminRoleService.addBatch(vo.getList());
    }

    @PostMapping("/update")
    public ResultDto update(@RequestBody RAdminRoleVo vo) {
        return rAdminRoleService.update(vo);
    }

    @PostMapping("/delete")
    public ResultDto delete(@RequestBody RAdminRoleVo vo) {
        return rAdminRoleService.delete(vo.getId());
    }

    @PostMapping("/deleteBatch")
    @ApiOperation("批量删除当前用户的角色")
    public ResultDto deleteBatch(@RequestBody ListIdsVo vo) {
        return rAdminRoleService.deleteBatch(vo.getList());
    }

    @PostMapping("/status")
    public ResultDto status(@RequestBody RAdminRoleVo vo) {
        return rAdminRoleService.status(vo.getId());
    }
}
